package com.example.sopt;

import android.app.Activity;
import android.os.Bundle;

import android.app.TabActivity; 
import android.content.Intent; 
import android.os.Bundle; 
import android.widget.TabHost; 
  
public class SampleTabActivity extends TabActivity { 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.main); 
  
        // setup tab widget 
        setupTabs(); 
        
    } 
      
    /** 
     * setup tab widget 
     */
    private void setupTabs() { 
        TabHost tabs = getTabHost(); 
          
        // TAB 01  
        TabHost.TabSpec spec = null; 
        Intent intent = null; 
          
        spec = tabs.newTabSpec("tab01"); 
        intent = new Intent(this, SubPage01Activity.class); 
        intent.putExtra("mode", "new"); 
        intent.putExtra("initialize", true); 
        intent.putExtra("request", true); 
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); 
        spec.setContent(intent); 
        spec.setIndicator("My Dress"); 
        tabs.addTab(spec); 
          
        // TAB 02  
        spec = tabs.newTabSpec("tab02"); 
        intent = new Intent(this, SubPage02Activity.class); 
        intent.putExtra("mode", "new"); 
        intent.putExtra("initialize", true); 
        intent.putExtra("request", true); 
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); 
        spec.setContent(intent); 
  
        spec.setIndicator("Top"); 
        tabs.addTab(spec); 
          
        // TAB 03  
        spec = tabs.newTabSpec("tab03"); 
        intent = new Intent(this, SubPage03Activity.class); 
        intent.putExtra("mode", "new"); 
        intent.putExtra("initialize", true); 
        intent.putExtra("request", true); 
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); 
        spec.setContent(intent); 
  
        spec.setIndicator("botton"); 
        tabs.addTab(spec); 
        
     // TAB 04  
        spec = tabs.newTabSpec("tab04"); 
        intent = new Intent(this, SubPage04Activity.class); 
        intent.putExtra("mode", "new"); 
        intent.putExtra("initialize", true); 
        intent.putExtra("request", true); 
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); 
        spec.setContent(intent); 
  
        spec.setIndicator("etc"); 
        tabs.addTab(spec); 
          
        // set current tab 
        tabs.setCurrentTab(0); 
          
         
    } 
      
}